//
//  ContentTableViewCell.m
//  ShouYi
//
//  Created by yurui on 16/2/20.
//  Copyright © 2016年 yurui. All rights reserved.
//

#import "ContentTableViewCell.h"
@implementation ContentTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        
        self.contentView.backgroundColor = [UIColor colorWithRed:235.0/255 green:235.0/255 blue:235.0/255 alpha:1];
        
        UIView *backView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kWidth, 119)];
        backView.backgroundColor = [UIColor whiteColor];
        [self.contentView addSubview:backView];

        
        
        self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, (kWidth - 40) * 2 / 3, 64)];
        self.titleLabel.numberOfLines = 0;
        self.titleLabel.font = [UIFont systemFontOfSize:15];
        //self.titleLabel.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_titleLabel];
        // 内容图片
        self.contentImageView = [[UIImageView alloc]initWithFrame:CGRectMake((kWidth - 40) * 2 / 3 + 30, 10, (kWidth - 40) / 3, 64)];
        //self.contentImageView.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_contentImageView];
        // 地址标志图
        self.addressImageView = [[UIImageView alloc]initWithFrame:CGRectMake(10, 92, 15, 15)];
       // self.addressImageView.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:_addressImageView];
        //地址
        self.addressLabel = [[UILabel alloc]initWithFrame:CGRectMake(30, 92, 60, 20)];
        //self.addressLabel.backgroundColor = [UIColor blueColor];
        self.addressLabel.font = [UIFont systemFontOfSize:13];
        self.addressLabel.textColor = [UIColor colorWithRed:100 / 255.0 green:194 / 255.0 blue:190 / 255.0 alpha:1];
        [self.contentView addSubview:_addressLabel];
        //进度
        self.jinDuLabel = [[UILabel alloc]initWithFrame:CGRectMake(95, 90, 30, 20)];
        //self.jinDuLabel.backgroundColor = [UIColor yellowColor];
        self.jinDuLabel.text = @"进度";
        self.jinDuLabel.textColor = [UIColor grayColor];
        self.jinDuLabel.font = [UIFont systemFontOfSize:13];
        [self.contentView addSubview:_jinDuLabel];
        // 进度总数
        self.titalNumLabel = [[UILabel alloc]initWithFrame:CGRectMake(125, 90, 40, 20)];
        self.titalNumLabel.textColor = [UIColor colorWithRed:231 / 255.0 green:141 / 255.0 blue:126 / 255.0 alpha:1];
        self.titalNumLabel.textAlignment = NSTextAlignmentRight;
        //self.titalNumLabel.backgroundColor = [UIColor grayColor];
        self.titalNumLabel.font = [UIFont systemFontOfSize:13];
        [self.contentView addSubview:_titalNumLabel];
        // 进度数
        self.jinDuNumLabel = [[UILabel alloc]initWithFrame:CGRectMake(165, 90, 60, 20)];
        self.jinDuNumLabel.textAlignment = NSTextAlignmentLeft;
        self.jinDuNumLabel.text = @"/5100";
        self.jinDuNumLabel.textColor = [UIColor blackColor];
        self.jinDuNumLabel.font = [UIFont systemFontOfSize:13];
        [self.contentView addSubview:_jinDuNumLabel];
        //
        self.xiaXianLabel = [[UILabel alloc]initWithFrame:CGRectMake(kWidth - 100, 90, 90, 20)];
        self.xiaXianLabel.textAlignment = NSTextAlignmentRight;
        self.xiaXianLabel.text = @"03-01下线";
        self.xiaXianLabel.textColor = [UIColor grayColor];
        self.xiaXianLabel.font = [UIFont systemFontOfSize: 11];
        [self.contentView addSubview:_xiaXianLabel];
        
    }
    return self;
}


- (void)setModelForTaskList:(TaskListModel *)model {
    
    self.titleLabel.text = model.title;
    
    [self.contentImageView sd_setImageWithURL:[NSURL URLWithString:model.imgsrc] placeholderImage:nil];
    self.addressImageView.image = [UIImage imageNamed:@"icon_di.png"];
    self.addressLabel.text = model.diqushow;
    [self.addressLabel sizeToFit];
    self.jinDuLabel.text = @"进度";
    self.jinDuLabel.frame = CGRectMake(_addressLabel.frame.size.width + _addressLabel.frame.origin.x + 10, _addressLabel.frame.origin.y, 100, 20);
    [self.jinDuLabel sizeToFit];
    
    self.titalNumLabel.text = [NSString stringWithFormat:@"%@",model.jidu_now];
    self.titalNumLabel.frame = CGRectMake(_jinDuLabel.frame.size.width + _jinDuLabel.frame.origin.x + 5, _jinDuLabel.frame.origin.y, 100, 20);
    [self.titalNumLabel sizeToFit];
    self.jinDuNumLabel.text = [NSString stringWithFormat:@"/%@",model.jidu_all];
    self.jinDuNumLabel.frame = CGRectMake(_titalNumLabel.frame.size.width + _titalNumLabel.frame.origin.x, _titalNumLabel.frame.origin.y, 100, 20);
    [self.jinDuNumLabel sizeToFit];

    self.xiaXianLabel.text = model.endtime;
    
    
    
//    self.xiaXianLabel.text = model.addtime;
//    self.xiaXianLabel.frame = CGRectMake(_jinDuNumLabel.frame.size.width + _jinDuNumLabel.frame.origin.x, _jinDuNumLabel.frame.origin.y,120, 17);
//    
    
}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
